package Metier.Objets;

import java.sql.Timestamp;

public class LotCuisson extends Lot implements Comparable {

    private String nom;

    private Timestamp date;

    private boolean estArchive;

    public LotCuisson(int id, String nom, int quantite, Produit produit) {
        super(id, quantite, produit);
        this.nom = nom;
        java.util.Date d = new java.util.Date();
        this.date = new java.sql.Timestamp(d.getTime());
        this.estArchive = false;
    }

    public LotCuisson(int id, String nom, int quantite, Timestamp date, Produit produit) {
        super(id, quantite, produit);
        this.nom = nom;
        this.date = date;
        this.estArchive = false;
    }

    @Override
    public int compareTo(Object o) {
        int i = ((LotCuisson)o).getProduit().getNom().compareTo(this.getProduit().getNom());
        if (i == 0) {
            i = ((LotCuisson)o).getDate().compareTo(this.getDate());
        } else {
            i =  -i;
        }
        return i;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public Timestamp getDate() {
        return date;
    }

    public void setDate(Timestamp date) {
        this.date = date;
    }

    public boolean isEstArchive() {
        return estArchive;
    }

    public void setEstArchive(boolean estArchive) {
        this.estArchive = estArchive;
    }
}
